package pcsr.drivers.nxtDriver;

import pcsr.drivers.nxtDriver.command.NXTCommand;

class NXTSensorFactory {

	enum NXTSensorFactoryType {
        LightSensor,
        TouchSensor,
        TiltSensor
    }
 
	NXTSensorFactory( )
	 {}
	 
	 public INXTSensor createSensor( NXTPort sensor, NXTSensorFactoryType sensorType ) {
	    switch (sensorType) {
	        case LightSensor:
	            return new NXTLightSensor(sensor, NXTCommand.GetSingleton());
	        case TouchSensor:
	            return new NXTTouchSensor(sensor, NXTCommand.GetSingleton());
	        case TiltSensor:
	            return new NXTTiltSensor(sensor, NXTCommand.GetSingleton());
	    }
	    throw new IllegalArgumentException("The sensor type " + sensorType + " is not recognized.");
	 }
}
